<?php defined("IN_SYSTEM") or die("Access Denied");/* 防止模板被盗 */?><!DOCTYPE html>
<html lang="en">
	<head>
		{include file="block/head" /}
	</head>
	<body class="lay-blog">
		{include file="block/header" /}
		<div class="container-wrap">
			<div class="container container-message container-details">
					<div class="contar-wrap">
						<div class="item">
							<div class="item-box layer-photos-demo1 layer-photos-demo">
								<h1><a href="{$data['data']['id']}.html">{$data['data']['title']}</a></h1>
								<h5>发布于：<span>{$data['data']['publish_time']}</span></h5>
								<p>{:htmlspecialchars_decode($data['data']['content'])}</p>
								<div class="count layui-clear">
									<span class="pull-left">阅读 <em>{$data['data']['views']}</em></span>
									<span class="pull-right like" data-url="{:url('ajax/articleLike', ['id' => $data['data']['id']])}" data-id="{$data['data']['id']}" data-like="{$data['data']['like']}"><i class="layui-icon layui-icon-praise"></i><em>{$data['data']['like']}</em></span>
								</div>
							</div>
						</div>	
						<a name="comment"> </a>
						<div class="comt layui-clear">
							<a href="javascript:;" class="pull-left">评论</a>
							<a href="javascript:;" class="pull-right close" id="write-comment-btn">写评论</a>
						</div>
						<div class="contar-wrap" id="contar-wrap">
							<form class="layui-form" action="{:url('ajax/postComment')}" method="post" id="comment-form" style="height:0;overflow:hidden;">
								<div class="layui-form-item layui-form-text">
									  <textarea placeholder="请在此输入评论内容" class="layui-textarea" name="content" style="resize:none"></textarea>
								</div>
								<div class="item-btn">
									<input type="input" class="layui-input item-input" id="blog-guest-nick" name="nick" placeholder="昵称">
									<input type="input" class="layui-input item-input" id="blog-guest-email" name="email" placeholder="邮箱">
									<input type="hidden" name="article_id" value="{$data['data']['id']}" />
									<button type="submit" class="layui-btn layui-btn-normal" id="comment-btn">提交</button>
								</div>
							</form>
							<div class="comment-wrap">
								<div id="LAY-msg-box">加载中...</div>
								<div id="LAY-msg-pages" class="paging"></div>
							</div>
						</div>
					</div>
			</div>
		</div>
		<script type="text/javascript">
			const msgGetUrl = '{:url('ajax/comments', ['article_id' => $data['data']['id']])}';
		</script>
		{include file="block/commentTpl" likeUrl="/blog/ajax/commentLike" /}
		{include file="block/footer" /}
		<script type="text/javascript">
			layui.use(['jquery'], function(){
				var $ = layui.jquery;
				$('#write-comment-btn').on('click', function() {
					var that = $(this);
					if (that.hasClass('close')) {
						that.removeClass('close').text('关闭评论');
						$('#comment-form').animate({height:170});
					} else {
						that.addClass('close').text('写评论');
						$('#comment-form').animate({height:0});
					}
				});
			});
		</script>
	</body>
</html>